home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr48 / tsbat146.zip / REZIP.BAT < prev    next >
DOS Batch File  |  1992-08-28  |  5KB  |  157 lines

  1. echo off
  2. echo.
  3. echo ┌───────────────────────────────────────────────────────────┐
  4. echo │ Unzip and then zip again a .zip file to remove -av label  │
  5. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Thu 27-Aug-1992   │
  6. echo └───────────────────────────────────────────────────────────┘
  7.  
  8. rem If no parameters then give the instructions
  9. if "%1"=="" goto _help
  10.  
  11. rem Check that the zip file exists
  12. if not exist %1 goto _nofile
  13.  
  14. rem Check that there are no wild cards in the file name
  15. for %%f in (%1) do if "%%f"=="%1" goto _is_ask
  16. echo Wildcards are not allowed in %1
  17. goto _out
  18.  
  19. rem Check that the ask.exe program is available
  20. :_is_ask
  21. set _found=
  22. if exist ask.exe set _found=yes
  23. for %%d in (%path%) do if exist %%d\ask.exe set _found=yes
  24. if "%_found%"=="yes" goto _isunzip
  25. echo Timo's batch enhancement ask.exe must be at path or in the current directory
  26. goto _out
  27.  
  28. rem Check that the pkunzip.exe program is available
  29. :_isunzip
  30. set _found=
  31. if exist pkunzip.exe set _found=yes
  32. for %%d in (%path%) do if exist %%d\pkunzip.exe set _found=yes
  33. if "%_found%"=="yes" goto _ispkzip
  34. echo pkunzip.exe must be at path or in the current directory
  35. goto _out
  36.  
  37. rem Check that the pkzip.exe program is available
  38. :_ispkzip
  39. set _found=
  40. if exist pkzip.exe set _found=yes
  41. for %%d in (%path%) do if exist %%d\pkzip.exe set _found=yes
  42. if "%_found%"=="yes" goto _chk_r
  43. echo pkzip.exe must be at path or in the current directory
  44. goto _out
  45.  
  46. rem Check that there is a r: drive available
  47. :_chk_r
  48. if not exist r:\nul goto _noram
  49.  
  50. rem Make a temporary directory
  51. if not exist r:\tmp$$$\nul md r:\tmp$$$
  52.  
  53. :_isempty
  54. if not exist r:\tmp$$$\*.* goto _test
  55. echo The auxiliary directory r:\tmp$$$ is not empty
  56. :_ask1
  57. ask Delete the files (y/n)? /d /u
  58. if errorlevel==89 if not errorlevel==90 goto _del
  59. if errorlevel==78 if not errorlevel==79 goto _out
  60. goto _ask1
  61.  
  62. rem Delete files from r:\tmp$$$
  63. :_del
  64. del r:\tmp$$$\*.*
  65. goto _isempty
  66.  
  67. rem Test archive integrity
  68. :_test
  69. pkunzip -t %1
  70. if errorlevel==1 goto _unziperr
  71. goto _ask2
  72.  
  73. :_unziperr
  74. echo Error in %1
  75. ask Continue nevertheless (y/n)? /d /u
  76. if errorlevel==89 if not errorlevel==90 goto _ask2
  77. if errorlevel==78 if not errorlevel==79 goto _out
  78. goto _unziperr
  79.  
  80. :_ask2
  81. ask Old %1 will be deleted, ok (y/n)? /d /u
  82. if errorlevel==89 if not errorlevel==90 goto _pkunzip
  83. if errorlevel==78 if not errorlevel==79 goto _out
  84. goto _ask2
  85.  
  86. rem Unzip the .zip archive
  87. :_pkunzip
  88. pkunzip %1 r:\tmp$$$
  89. if not exist r:\tmp$$$\*.zip goto _ask3
  90. echo Warning: There are .zips within %1
  91. pause
  92.  
  93. :_ask3
  94. ask Insert e:\arczip\comment.txt as zip comment (y/n)? /d /u
  95. if errorlevel==89 if not errorlevel==90 goto _com_yes
  96. if errorlevel==78 if not errorlevel==79 goto _com_no
  97. goto _ask3
  98.  
  99. rem Check that the comment.txt file program is available
  100. :_com_yes
  101. if exist e:\arczip\comment.txt goto _with_com
  102. echo e:\arczip\comment.txt not found
  103. echo Adjust the path as necessary
  104. goto _out
  105.  
  106. rem Delete and make a new .zip archive with zip comment
  107. :_with_com
  108. del %1 > nul
  109. pkzip -br:\ -mu -o -z %1 r:\tmp$$$\*.* < e:\arczip\comment.txt
  110. goto _rd
  111.  
  112. rem Delete and make a new .zip archive without zip comment
  113. :_com_no
  114. del %1 > nul
  115. pkzip -br:\ -mu -o %1 r:\tmp$$$\*.*
  116. goto _rd
  117.  
  118. :_rd
  119. pkzip -v %1
  120. rd r:\tmp$$$
  121. goto _out
  122.  
  123. rem Error messages
  124. :_nofile
  125. echo File %1 not found
  126. goto _out
  127.  
  128. :_noram
  129. echo You must have a (ram)disk available as drive r:
  130. goto _out
  131.  
  132. :_help
  133. echo                      ┌──────────────┐
  134. echo Usage REZIP FileName │ No wildcards │ (paths are ok)
  135. echo                      └──────────────┘
  136. echo Since someone cracked the pkzip 1.10 authenticity (-av) code some BBSes
  137. echo have been putting in their own ads as the authenticity labels. The
  138. echo purpose of this batch is to remove these labels, which may give the
  139. echo users a false sense of security.
  140. echo Note that any .zips within the .zip will not be cleaned.
  141. echo.
  142. echo You will need the following shareware and PD programs to use this batch.
  143. echo They are available from good BBSes or from garbo.uwasa.fi by anonymous ftp.
  144. echo      PKUNZIP.EXE and PKZIP.EXE from PKZ110.EXE or PKZ110EU.EXE
  145. echo      ASK.EXE from TSBAT37.ZIP
  146. echo.
  147. echo Advanced trick for MsDos 3.30+: To use wildcards apply:
  148. echo   for %%f in (*.zip) do call rezip %%f
  149. echo If you get an "Out of environment space" message, increase your
  150. echo environment space by using shell configuration in config.sys:
  151. echo MsDos 3.30 example: shell=c:\bin\command.com /e:1024 /p
  152. goto _out
  153.  
  154. :_out
  155. set _found=
  156. echo on
  157.